<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .tab_con {
            width: 500px;
            height: 350px;
            margin: 50px auto 0;
        }
        
        .tab_btns {
            height: 50px;
        }
        
        .tab_btns input {
            width: 100px;
            height: 50px;
            background: #ddd;
            border: 0px;
            outline: none;
        }
        
        .tab_btns .active {
            background: gold;
        }
        
        .tab_cons {
            height: 300px;
            background: gold;
        }
        
        .tab_cons div {
            height: 300px;
            line-height: 300px;
            text-align: center;
            display: none;
            font-size: 30px;
        }
        
        .tab_cons .current {
            display: block;
        }
    </style>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
</head>

<body>
    <div class="tab_con">
        <div class="tab_btns">
            <input type="button" value="按钮一" :class="num==1?'active':''" @click="tabClick(1)">
            <input type="button" value="按钮二" :class="num==2?'active':''" @click="tabClick(2)">
            <input type="button" value="按钮三" :class="num==3?'active':''" @click="tabClick(3)">
        </div>
        <div class="tab_cons">
            <div :class="num==1?'current':''">按钮一对应的内容</div>
            <div :class="num==2?'current':''">按钮二对应的内容</div>
            <div :class="num==3?'current':''">按钮三对应的内容</div>
        </div>
    </div>
    <script>
        // 用户通过操作界面改变数据层中的数据num的值
        // 而num的值一旦变化，又会影响界面上使用到这个数据的地方
        // Vue思想 ： 页面的变化，都是数据变化
        new Vue({
            el: '.tab_con',
            data: {
                num: 1
            },
            methods: {
                tabClick(val) {
                    this.num = val
                }
            }
        })
    </script>
</body>

</html>